
import axios from 'axios';

/**
 * 库存记录
 */
export class StockRecordService {
    // 分页查询列表
    static findStockRecords (queryParams) {
        return axios({
            url: '/restaurant/material/StockRecord/findStockRecords',
            method: 'POST',
            data: queryParams
        });
    }

    //根据ID查询指定的库存记录
    static findStockRecord (stockRecordId) {
        const query = {
            stockRecordId
        }
        return axios({
            url: '/restaurant/material/StockRecord/findStockRecord',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的库存记录(包含外键名称)
    static findStockRecordForView (stockRecordId) {
        const query = {
            stockRecordId
        }
        return axios({
            url: '/restaurant/material/StockRecord/findStockRecordForView',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的库存记录(包含外键名称)
    static findStockRecordForEdit (stockRecordId) {
        const query = {
            stockRecordId
        }
        return axios({
            url: '/restaurant/material/StockRecord/findStockRecordForEdit',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的库存记录(只提取ID 和 Name)
    static findStockRecordsWithIdNameById (stockRecordId) {
        const query = {
            stockRecordId
        }
        return axios({
            url: '/restaurant/material/StockRecord/findStockRecordsWithIdNameById',
            method: 'POST',
            params: query,
        });
    }

    //根据名称查询库存记录集合(只提取ID 和 Name)
    static findStockRecordsWithIdNameByName (stockRecordName) {
        const query = {
            stockRecordName
        }
        return axios({
            url: '/restaurant/material/StockRecord/findStockRecordsWithIdNameByName',
            method: 'POST',
            params: query,
        });
    }
    //材料入库


    //新增保存库存记录
    static saveStockRecord (stockRecord) {
        const query = {}
        return axios({
            url: '/restaurant/material/StockRecord/saveStockRecord',
            method: 'POST',
            params: query,
            data: stockRecord
        });
    }

    //修改保存库存记录
    static updateStockRecord (stockRecord) {
        const query = {}
        return axios({
            url: '/restaurant/material/StockRecord/updateStockRecord',
            method: 'POST',
            params: query,
            data: stockRecord
        });
    }

    //根据ID查询指定的库存记录(只提取ID 和 Name)
    static deleteStockRecord (stockRecordId) {
        const query = {
            stockRecordId
        }
        return axios({
            url: '/restaurant/material/StockRecord/deleteStockRecord',
            method: 'POST',
            params: query,
        });
    }
}
